﻿using Common.Extensions.OrderBy;
using DomainModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;

namespace IManager
{
    public interface IManagerLinks
    {
        /// <summary>
        /// 通过Id获取
        /// </summary>
        /// <param name="linkId">Id</param>
        /// <returns>LinksInfo</returns>
        LinksInfo GetLink(int linkId);


        /// <summary>
        /// 通过Id获取
        /// </summary>
        /// <param name="cid"></param>
        /// <param name="tid"></param>
        /// <returns>LinksInfo</returns>
        LinksInfo GetLink(int cid,string tid);


        /// <summary>
        /// 添加信息
        /// </summary>
        /// <param name="link">信息</param>
        /// <returns>True=操作成功/False=操作失败</returns>
        bool AddLink(LinksInfo link);


        /// <summary>
        /// 删除信息
        /// </summary>
        /// <param name="linkIdList">Id列表</param>
        /// <returns>True=操作成功/False=操作失败</returns>
        bool DeleteLink(IList<int> linkIdList);


        /// <summary>
        /// 更新信息
        /// </summary>
        /// <param name="link">信息</param>
        /// <returns>True=操作成功/False=操作失败</returns>
        bool UpdateLink(LinksInfo link);


        /// <summary>
        /// 根据条件分页获得记录
        /// </summary>
        /// <param name="where">条件</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">每页大小</param>
        /// <param name="orderByExpressions">排序字段</param>
        /// <returns>记录列表</returns>
        IList<LinksInfo> LoadAll(Expression<Func<LinksInfo, bool>> where,
                                                   int pageIndex,
                                                   int pageSize,
                                                   params IOrderByExpression<LinksInfo>[] orderByExpressions);


        /// <summary>
        /// 获取总数
        /// </summary>
        /// <param name="where">条件</param>
        /// <returns>记录总数</returns>
        int LoadCount(Expression<Func<LinksInfo, bool>> where);

    }
}
